# -*- coding: utf-8 -*-
# @Time    : 2019/11/7 15:39
# @Author  : xiao
import os
import sys
import unittest

from basic.utils.runnerInit import CaseRunner
from basic.utils.Email import sendEmail

from basic.utils.path import Path
from BeautifulReport import BeautifulReport as bf

from test.help.webtest import WebDomeCase

current_directory = os.path.dirname(os.path.abspath(__file__))
root_path = os.path.abspath(os.path.dirname(current_directory) + os.path.sep + ".")
sys.path.append(root_path)

if __name__ == '__main__':

   #方式一
   # suite=unittest.TestSuite()
   # suite.addTest(pocesuite("test_two"))
   # suite.addTest(pocesuite("test_first"))
   # suite.addTest(pocesuiteDome("test_first"))
   # suite.addTest(pocesuiteDome("test_two"))
   # unittest.TextTestRunner(verbosity=2).run(suite)

   #方式二
   # suite1=unittest.TestSuite(unittest.makeSuite(pocesuite))
   # suite2=unittest.TestSuite(unittest.makeSuite(pocesuiteDome))
   # suite=unittest.TestSuite()
   # suite.addTest(suite1)
   # suite.addTest(suite2)
   # unittest.TextTestRunner(verbosity=2).run(suite)

   # # 方式三
   # suite=unittest.TestSuite(unittest.findTestCases("test"))
   # unittest.TextTestRunner(verbosity=2).run(suite)

   #方式四
   # classNameList=[pocesuiteDome]
   # suite=UIParent.runCases(classNameList)
   # unittest.TextTestRunner(verbosity=2).run(suite)
   #

   #报告
   # classNameList = [ bsCase, growValueCase, dataSecretaryCase]
   classNameList = [WebDomeCase]
   suite = CaseRunner.runCases(classNameList)
   run = bf(suite)  # 实例化BeautifulReport模块
   run.report(filename='test',report_dir=Path.getProjectPath()+"/res/report", description='UI自动化测试用例')
   sendEmail("UI自动化测试", CaseRunner.caseResult(run, 0), 1)
